package com.cjkj.system.controller;

import com.cjkj.common.core.exception.ServiceException;
import com.cjkj.common.core.web.domain.AjaxResult;
import com.cjkj.system.api.domain.request.RecordsReq;
import com.cjkj.system.service.ReportTJ03Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 心电血压监测报告控制器
 */
@RestController
@RequestMapping("reports/tj03")
public class ReportTJ03Controller {

    @Resource
    private ReportTJ03Service reportTJ03Service;

    /**
     * 体测报告-心率
     * @param req
     */
    @GetMapping("/heartRate")
    public AjaxResult heartRateReports(RecordsReq req){
        if(req.getVisitNo() == null){
            throw new ServiceException("就诊号不能为空！");
        }
        return AjaxResult.success(reportTJ03Service.getTJ03HeartRateReports(req.getVisitNo()));
    }

    /**
     * 体测报告-血压
     * @param req
     */
    @GetMapping("/bloodPressure")
    public AjaxResult bloodPressureReports(RecordsReq req){
        if(req.getVisitNo() == null){
            throw new ServiceException("就诊号不能为空！");
        }
        return AjaxResult.success(reportTJ03Service.getTJ03BloodPressureReports(req.getVisitNo()));
    }

    /**
     * 体测报告-心电
     * @param req
     */
    @GetMapping("/ecg")
    public AjaxResult ecgReports(RecordsReq req){
        if(req.getVisitNo() == null){
            throw new ServiceException("就诊号不能为空！");
        }
        return AjaxResult.success(reportTJ03Service.getTJ03ECGReports(req.getVisitNo()));
    }
}
